package com.common.mycommons.controller;

import com.alibaba.fastjson.JSONObject;
import com.common.mycommons.util.WordExportUtil;
import com.common.mycommons.util.WordUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;

@RequestMapping("/myTest")
@Controller
public class MyController {
    private static final Logger LOGGER = LoggerFactory.getLogger(MyController.class);

    @RequestMapping("/fileExport")
    public String fileExport(HttpServletResponse response){
//        String data="{\"paramList\":[\"参数一：医嘱类型：\",\"参数二：医疗类别：\",\"参数三：业务分组_就诊： \",\"参数四：业务分组依赖:入院日期/出院日期： \",\"参数五：违规金额公式：处方.总费用-知识.限制单价*处方.数量\",\"参数六：业务分组类别:单次/年/月/日：单次就诊\",\"参数七：医疗就诊类型：\",\"参数八：业务分组_处方： \",\"参数九：险种类型：\",\"参数十：明细输出：【医保项目名称/医院项目名称】项目已超最高限价，实际单价为实际单价金额元，物价部门规定的最高单价为最高单价金额元，超最高单价总金额为实际单价金额-最高单价金额元。\",\"参数一十一：知识范围：临床知识：不启用\",\"参数一十二：违规范围：全部处方\",\"参数一十三：机构等级收费：0\",\"参数一十四：知识匹配：医保目录(药品)代码\",\"参数一十五：排除自费：否\",\"参数一十六：知识范围：自定义知识：不启用\"],\"admdvs\":\"100000\",\"admdvsName\":\"中央本级\",\"enabFlag\":\"1\",\"enabFlagName\":\"是\",\"hisVerFlag\":\"0\",\"initSoucRuleId\":\"JA00000001190020000\",\"memo\":\"诊疗项目超限定价格\",\"mnitScen\":\"1\",\"mnitScenName\":\"事前\",\"prntSoucRuleId\":\"JA00000001190020000\",\"progCode\":\"JA000000002000000\",\"rid\":\"100000202004131558131000039001\",\"rlsTime\":1582983375000,\"rlsTimeStr\":\"2020-02-29 21:36:15\",\"rptTime\":1586764694000,\"rptTimeStr\":\"2020-04-13 15:58:14\",\"ruleCode\":\"JA1000001199002001\",\"ruleDefnType\":\"1\",\"ruleDefnTypeName\":\"医保管理类\",\"ruleDscr\":\"诊疗项目超限定价格\",\"volaEvid\":\"诊疗项目超限定价格\",\"ruleId\":\"100000202004131439121000066001\",\"ruleLv\":\"A\",\"ruleLvName\":\"国家级\",\"ruleName\":\"诊疗项目超限定价格\",\"ruleSevDeg\":\"2\",\"ruleSevDegName\":\"高度可疑\",\"ruleSouc\":\"诊疗项目超限定价格\",\"ruleStas\":\"4\",\"ruleStasName\":\"待发布\",\"ruleVer\":\"1.0\",\"updtTime\":1586764604000,\"updtTimeStr\":\"2020-04-13 15:56:44\",\"volaQualCodg\":\"19\",\"volaQualName\":\"医疗服务项目收费超限价\",\"ruleKngListTabOne\":[{\"C0\":\"项目代码\",\"C1\":\"医保限价\",\"C2\":\"无等级\",\"C3\":\"一级丙等\",\"C4\":\"一级乙等\",\"C5\":\"一级甲等\",\"C6\":\"二级丙等\",\"C7\":\"二级乙等\",\"C8\":\"二级甲等\",\"C9\":\"三级丙等\",\"C10\":\"三级乙等\",\"C11\":\"三级甲等\",\"C12\":\"三级特等\"},{\"C0\":\"I-002\",\"C1\":\"12121\",\"C2\":\"1212\",\"C3\":\"121\",\"C4\":\"212\",\"C5\":\"13\",\"C6\":\"4354\",\"C7\":\"234324\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-001\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-003\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-004\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-005\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-006\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-007\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-008\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-009\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-010\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-011\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-012\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"},{\"C0\":\"I-013\",\"C1\":\"11111\",\"C2\":\"1111\",\"C3\":\"111\",\"C4\":\"11\",\"C5\":\"111\",\"C6\":\"111\",\"C7\":\"111\",\"C8\":\"\",\"C9\":\"\",\"C10\":\"\",\"C11\":\"\",\"C12\":\"\"}],\"ruleKngListTabTwo\":[],\"ruleName\":\"诊疗项目超限定价格\"}";
//        JSONObject jsonObject = JSONObject.parseObject(data);
//        WordUtil.wordExportTemplate("templates/rule.docx", "测试word.docx", jsonObject, response);
        WordExportUtil.wordExport("测试.docx", response);
        return "1";
    }
}
